function DefaultEffectMode() {
    this._hoverEffectMask = new HoverMask($('#calendar-day-hover-mask'));
    this._selectEffectMask = new SelectMask($('#calendar-day-select-mask'));
    this._resetSelection();
    var me = this;
    $('body').mouseup(function(e) {
        if (me._startDay && me._endDay) {
            e.data = { start: me._startDay, end: me._endDay, dateRange: me._getDateRange() };
            if (me._innerMode.onSelection) {
                me._innerMode.onSelection.call(me._innerMode, me._endDay, e);
            }
        }
        me._onSelect = false;
        me._startDay = null;
        me._endDay = null;
        me._clearSelection();
    });
}
DefaultEffectMode.prototype = {
    setInnerMode: function(mode) {
        this._innerMode = mode;
    },
    clearSelection: function() {
        this._clearSelection();
        this._hoverEffectMask.hide();
        this._resetSelection();
    },
    _resetSelection: function() {
        this._onSelect = false;
        this._startDay = null;
        this._endDay = null;
        this._innerMode = {};
    },
    onMouseenter: function(sender, e) {
        if (this._onSelect) {
            this._endDay = sender;
            this._showSelection();
        }
        if (this._innerMode.onMouseenter) {
            this._innerMode.onMouseenter.call(this._innerMode, sender, e);
        }
    },
    onMouseover: function(sender, e) {
        if (!this._onSelect) {
            this._hoverEffectMask.show(sender);
        }
        if (this._innerMode.onMouseover) {
            this._innerMode.onMouseover.call(this._innerMode, sender, e);
        }
    },
    onMouseout: function(sender, e) {
        if (!this._onSelect) {
            this._hoverEffectMask.hide();
        }
        if (this._innerMode.onMouseout) {
            this._innerMode.onMouseout.call(this._innerMode, sender, e);
        }
    },
    onMousedown: function(sender, e) {
        this._hoverEffectMask.hide();
        this._onSelect = true;
        this._startDay = sender;
        this._endDay = this._startDay;
        this._showSelection();
        if (this._innerMode.onMousedown) {
            this._innerMode.onMousedown.call(this._innerMode, sender, e);
        }
    },
    onMouseup: function(sender, e) {
        this._onSelect = false;
        if (this._innerMode.onMouseup) {
            this._innerMode.onMouseup.call(this._innerMode, sender, e);
        }

        e.data = { start: this._startDay, end: this._endDay, dateRange: this._getDateRange() };
        if (this._innerMode.onSelection) {
            this._innerMode.onSelection.call(this._innerMode, sender, e);
        }
        this._clearSelection();
        this._onSelect = false;
        this._startDay = null;
        this._endDay = null;
    },
    _getDateRange: function() {
        var endDate = new DayElement($(this._endDay)).getDate();
        var startDate = new DayElement($(this._startDay)).getDate();
        return new DateRange(startDate, endDate);
    },
    _showSelection: function() {
        this._clearSelection();
        var dateRange = this._getDateRange();
        var daysToFill = dateRange.toDayArray();
        this._selectEffectMask.show(daysToFill);
    },
    _clearSelection: function() {
        this._selectEffectMask.remove();
    }
};